//scroll js script @ Juraj Piovar 2014

$(document).ready(function(){

		
	var topp = 0,
		winp = $(window).height(),
		id1 = Math.ceil($('#id18').position().top);
	
	/*
	console.log(winp);
	console.log(id1);
	
	eclipse
	
	ok
	
	*/
	
	
	
	$( "body" ).append( "<span id='up_button'></span>" );
	
	$( "#up_button" ).css({"background-image":"url('assets/img/up.gif')","font-size":"40px","cursor":"pointer","position":"fixed","width":"40px","height":"40px","bottom":"10px","left":"10px"});
	
	$('#up_button').hide();
	
	
	$(window).scroll(function(){
	
		var winh = $(window).height(),
			actpos = $(window).scrollTop();
			
		
		//console.log(winh+" "+actpos);
			
		if(actpos>winh){
		
			$('#up_button').fadeIn('slow');
			
				
		}else {
		
			$('#up_button').fadeOut('slow');
		
		}	
	
	});
	
	
	$('#up_button').click(function(){
	
		$('html, body').animate({scrollTop:0}, 1000);
	
	});
	
	
	
	
});